package pnlBeheer;

import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import tblLSListner.TMSLMenu;
import tblModelMenu.TMMenu;
import controllerMenu.*;


public class PnlMenuBeheer extends JPanel{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8554587290564466652L;

	public JLabel lblTitle;
	
	public JPanel pnlTbl;
	public JTable tblMenu;
	public JScrollPane scroll;
	
	public JLabel lblNaam;
	public JLabel lblNieuwNaam;
	
	public ImageIcon imgUpdate;
	public ImageIcon imgDelete;
	
	public JButton btnupdate;
	public JButton btndelete;

	public JTextField txtNaam;
	public JTextField txtNieuwNaam;
	
	public MenuBtnUpdate mbu;
	public TMSLMenu tmslMenu;
	
	public TMMenu tmMenu;
	
	
	
	public PnlMenuBeheer(){
		
		this.mbu = new MenuBtnUpdate(this);
		this.tmMenu = new TMMenu(this);
		this.tmslMenu = new TMSLMenu(this);

		
		setBackground(Color.WHITE);
		setSize(1365,600);
		setVisible(true);
		setLayout(null);
		
		lblTitle = new JLabel("<html><h1><b>Menu beheer</b></h1></html>");
		lblTitle.setBounds(50, 50, 300, 40);
		add(lblTitle);
		
		lblNaam = new JLabel("Naam");
		lblNaam.setBounds(50, 150, 100, 20);
		add(lblNaam);
		
		lblNieuwNaam = new JLabel("Nieuwe naam");
		lblNieuwNaam.setBounds(50, 200, 100, 20);
		add(lblNieuwNaam);
		
		txtNaam = new JTextField();
		txtNaam.setBounds(150, 150, 200, 20);
		add(txtNaam);
		
		txtNieuwNaam = new JTextField();
		txtNieuwNaam.setBounds(150, 200, 200, 20);
		add(txtNieuwNaam);
		
		pnlTbl = new JPanel();
		pnlTbl.setLayout(new BorderLayout());
		pnlTbl.setBounds(600, 80, 700, 580);
		add(pnlTbl);
		
		String []names = {"Naam"};
		Object [][] obj = {{"Haaivinnensoep"}};
		
		tblMenu = new JTable(obj,names);
		tblMenu.setBounds(0,0,600,0);
		tblMenu.getSelectionModel().addListSelectionListener(tmslMenu);
		tblMenu.setModel(tmMenu);
		
		scroll = new JScrollPane(tblMenu);
		pnlTbl.add(scroll);
		
	
		
		imgUpdate = new ImageIcon(getClass().getResource("/image/update.gif"));
		btnupdate = new JButton("Update",imgUpdate);
		btnupdate.setHorizontalTextPosition(JButton.CENTER);
		btnupdate.setVerticalTextPosition(JButton.BOTTOM);
		btnupdate.setBounds(40, 250, 100, 90);
		btnupdate.setOpaque(false);
		btnupdate.setContentAreaFilled(false);
		btnupdate.setBorderPainted(false);
		btnupdate.setFocusPainted(false);
		btnupdate.addActionListener(mbu);
		btnupdate.setActionCommand("Update");
		add(btnupdate);
		

	}
		public JTextField getTxtNaam() {
			return txtNaam;
		}

		public JTextField getTxtNieuwNaam() {
			return txtNieuwNaam;
		}
		public JTable getTblMenu() {
			return tblMenu;
		}

	
}
